



      import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
    public class Demo01 {

        public static void main(String[] args) throws Exception{
            Class.forName("com.mysql.jdbc.Driver");
            String url="jdbc:mysql://localhost:3306/jwydb";
            String username="root";
            String password="123456";
            Connection con= DriverManager.getConnection(url,username,password);
            Statement stm=con.createStatement();
            String sql="select * from t_jwy";
            ResultSet rs=stm.executeQuery(sql);
            while(rs.next()){
                int cid=rs.getInt("id");
                String cname=rs.getString("name");
                int tid=rs.getInt("age");
                System.out.println("杜杜编号:"+cid+"哈哈类型:"+cname+"笨笨老师:"+tid);
            }
            stm.close();
            rs.close();
        }
    }


